# coding:utf-8

import os

# 安装app,为了方便，把app放到当前脚本同一目录
#os.system("adb install 1.0.0_debug_20190107.apk")

# coding:utf-8
from appium import webdriver
import os

# 获取项目的根目录路径
p = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)),""))
# 获取app路径
appPath = lambda x:os.path.join(p, "app/build/outputs/apk/debug/", x)
print(appPath("1.0.0_debug.apk"))

desired_caps = {
                'platformName': 'Android',
                'platformVersion': '7.0',
                'deviceName': 'HUAWEI nova',
                'app': appPath("1.0.0_debug.apk"),
                'appPackage': 'com.example.helloword',
                'appActivity': '.MainActivity',
                'noReset': 'false',
                }
driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)